package sql.ast;

public class AndNode extends Node{
    public AndNode(){}

    @Override
    public State execute(Context context) {
        for (Node child : this.children) {
            State ok = child.execute(context);
            if(ok == State.Break) {
                return State.Break;
            }
            if(ok == State.False) {
                return State.False;
            }
        }
        return State.True;
    }

    @Override
    public String toString() {
        return "AndNode{" +
                "children=" + children +
                '}';
    }
}
